<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="../../lib/html5shiv.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../lib/respond.min.js?rev=@@hash"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="../../lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../ht-css/Project.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="../../lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../ht-css/style-q.css" />
    <title>组织架构</title>
</head>
<body data-id="27">
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页  <span class="c-gray en">&gt;</span> 权限管理  <span class="c-gray en">&gt;</span> 组织架构 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<article class="page-container">
    <div class="org-box pl-20 pr-20">
        <div class="f-l bk-gray bg-1 pd-15 org-l">
            <div class="bk-gray bg-f4 pl-20 pr-20"><strong>部门名称</strong><a href="javascript:;" onclick="member_add('部门添加','department_add.html')" class="f-r powerButton 1000001017645877">新增</a></div>
            <div>
                <ul class="bk-gray pd-10 lh-30 mb-15" id="departmentName" >

                </ul>
            </div>
        </div>
        <div class="f-l bk-gray bg-1 ml-20 pd-15 org-r">
            <div class="bg-f4 pl-20 pr-20 depTitle"><i class="icon_group01 mr-5"></i><strong id="strong"></strong><span id="operateBtn"><a href="javascript:;" onclick="member_eidt('部门修改','department_add.html')" class="ml-10 editor powerButton 1000001004725699">编辑</a><a onclick="delete_department()" class="ml-10 delete powerButton 1000000884912873">删除</a></span></div>
            <div class="pl-20 pt-10 pb-25" id="depMenu" style="padding-bottom: 2px;"></div>
            <div class="line"></div>
            <div class="pl-20 pt-10 pb-10 nextDep"><i class="icon_group02 mr-5"></i><strong>下级部门</strong><a  href="javascript:;" onclick="memberSon_add('添加下级','department_add.html')" class="ml-10 powerButton 1000001017645877">添加下级</a></div>
            <div class="line"></div>
            <div >
                <ul class="pl-20 pt-10 pb-10 lh-30">
                    <li><a href="javascript:void(0);" onclick="listParent()" class="c-333"></a> </li>
                </ul>
            </div>
        </div>
    </div>
</article>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../../lib/jquery/1.9.1/jquery.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/layer/2.4/layer.js?rev=@@hash"></script>
<script type="text/javascript" src="../../static/h-ui/js/H-ui.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../static/h-ui.admin/js/H-ui.admin.js?rev=@@hash"></script> <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../../lib/My97DatePicker/4.8/WdatePicker.js?rev=@@hash"></script>
<!--表单验证-->
<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/jquery.validate.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/validate-methods.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/messages_zh.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/datatables/1.10.0/jquery.dataTables.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/laypage/1.2/laypage.js?rev=@@hash"></script>
<script src="../../ht-js/public.js?rev=@@hash"></script>
<!--验证token-->
<script src="../../ht-js/verifyToken.js?rev=@@hash"></script>
<script src="../../ht-js/access/organization.js?rev=@@hash"></script>
<script src="../../ht-js/Project.js?rev=@@hash"></script>
<script type="text/javascript" src="../../ht-js/power.js?rev=@@hash"></script>
<script>

    /*部门-添加*/
    function member_add(title,url){
        var editData = {
            DEPARTMENT_ISEIDT:'depParentAdd'
        };
        window.session_storage.setItem('department_editData',JSON.stringify(editData))
        var index = layer.open({
            type: 2,
            title: title,
            content: url
        });
        layer.full(index);
    }
    //编辑父级公司
    function member_eidt(title,url) {
        var editData = {
            DEPARTMENT_ISEIDT:'depParentEidt'
        };
        window.session_storage.setItem('department_editData',JSON.stringify(editData))
        var index = layer.open({
            type: 2,
            title: title,
            content: url
        });
        layer.full(index);
    }
    //删除部门
    function delete_department() {
        layer.confirm('确认要删除吗？',function(index){
            var depId = JSON.parse(window.session_storage.getItem('delDep')).DEPARTMENT_ID;
            var uname=JSON.parse(web.readCookie("loginData"))
            $.ajax({
                type: "POST",
                url: root.accessInter.access_department_deleteApi,
                data: {
                    DEPARTMENT_ID:depId,
                    USERNAME:uname.user.username
                },
                dataType:'json',
                cache: false,
                success: function (data) {
                    switch (data.code) {
                        case 200:
                            layer.msg(data.data.errors[0], {icon: 1, time: 1000});
                            var index =  location.reload();
                            layer.close(index);
                        case 403:
                            layer.msg(data.data.errors[0], {icon: 1, time: 1000});

                    }
                },
            });
        });
    }
    //添加子级公司
    function memberSon_add(title,url) {
        var editData = {
            DEPARTMENT_ISEIDT:'depChildAdd'
        };
        window.session_storage.setItem('department_editData',JSON.stringify(editData))
        var index = layer.open({
            type: 2,
            title: title,
            content: url,
        });
        layer.full(index);
    }
    //列表渲染
    web.user_list();



</script>
</body>
</html>